﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.Utils;

namespace WCS.Entity
{

    /// <summary>
    /// PDA发送任务到缓存区
    /// </summary>
    [SugarTable("WCS_PalletToMaterial")]
    public class PalletToMaterial
    {
        /// <summary>
        /// 托盘号
        /// </summary>
        public string PalletCode { get; set; }

        /// <summary>
        /// 物料类型
        /// </summary>
        public string MaterialType { get; set; }

        /// <summary>
        /// 物料ID
        /// </summary>
        public int ProductId { get; set; }

        public string Flag { get; set; }

        /// <summary>
        /// 数据库连接对象
        /// </summary>
        static SqlSugarDapper _SqlSugarDapper = SqlSugarDapper.GetDbContext();

        /// <summary>
        /// 根据托盘吗判断是什么物料
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static PalletToMaterial GeMaterialTypeByPallet(string code)
        {
            //根据物料号查询这个物料在那个仓库的第几层
            return _SqlSugarDapper.DB.Queryable<PalletToMaterial>().Where(w => w.PalletCode.Contains(code)).First();
        }
    }
    [SugarTable("WCS_PalletToMaterialPDA")]
    public class PalletToMaterialPDA
    {
        /// <summary>
        /// 托盘号
        /// </summary>
        public string PalletCode { get; set; }

        /// <summary>
        /// 物料类型
        /// </summary>
        public string MaterialType { get; set; }

        /// <summary>
        /// 物料ID
        /// </summary>
        public int ProductId { get; set; }

        public string Flag { get; set; }
    }
}
